<style scoped>
.home {
    padding: 10px 10px 10px 10px;
}

.home h1 {
    height: 40px;
}
</style>

<template>
<div class="home">
    <h1>Welcome, {{username}}</h1>
    <Button type="ghost" @click="quit">退出</Button> &nbsp;&nbsp;
    <Button type="ghost" @click="handleVa">数据验证</Button> &nbsp;&nbsp;
    <router-link to="/test">Test</router-link>
    <br></br>
    <Switch v-model="check1"></Switch> &nbsp;&nbsp;{{date1}}
    <br></br>
    <Test1 checkMsg="传递" :checkState="check1" @changeCb="(val)=>{check1=val}" @changeDt="(val)=>{date1=val}"></Test1>
    <br></br>
    <TestPage v-if="check1"></TestPage>
</div>
</template>

<script>
import {
    tokenMgr
} from '../libs/axiosPlugin';
import TestPage from './test.vue';

export default {
    methods: {
        quit() {
            tokenMgr.deleteToken();
        },
        handleVa() {
            this.$http.get('/api/userSer/user/get')
                .then((res) => {
                    this.$Message.info('获得返回结果：' + res.data);
                    this.username = res.data;
                });
        }
    },
    data() {
        return {
            username: localStorage.username,
            date1: '',
            check1: true
        };
    },
    components: {
        'TestPage': TestPage
    }
};
</script>